#include <iostream>
using namespace std;

int main() {
    char grid[110][110]{};
    bool light[110][110]{};

    int n, m;
    cin >> n >> m;
    
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> grid[i][j];
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (grid[i][j] == '@') {
                light[i][j] = true;
                int dirs[4][2] = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };
                for (int d = 0; d < 4; ++d) {
                    int dx = dirs[d][0];
                    int dy = dirs[d][1];
                    int x = i + dx;
                    int y = j + dy;
                    while (x >= 0 && x < n && y >= 0 && y < m) {
                        if (grid[x][y] == '*') {
                            light[x][y] = true;
                            break;
                        }
                        else {
                            light[x][y] = true;
                            x += dx;
                            y += dy;
                        }
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (light[i][j]) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}